<template>
	<view class="container">
		<!-- Custom Header (Integrated Nav and User Info) -->
		<Header :isHomepage="false"></Header>

		<!-- Page Title -->
		<text class="page-title">管理中心</text>

		<!-- Main Content Area (White Card) -->
		<view class="main-content">

			<!-- Account Info -->
			<view class="account-info">
				<view class="info-line">
					<text class="info-label">账号:</text>
					<text class="info-value phone-number">{{ userInfo.account?userInfo.account:'' }}</text>
					<text class="info-action">修改密码</text>
				</view>
				<view class="info-line">
					<text class="info-label">昵称(签名):</text>
					<text class="info-value">{{ userInfo.nickname?userInfo.nickname:'' }}</text>
					<text class="info-action">修改昵称</text>
				</view>
			</view>

			<!-- Management Buttons -->
			<view class="management-buttons">
				<button class="mgmt-button" @click="goToManage">管理纪念馆</button>
				<button class="mgmt-button" @click="goToUserInfo">账号管理</button>
				<button class="mgmt-button" @click="goToFamily">家族管理</button>
				<button class="mgmt-button" @click="goToPayInfo">充值永恒币</button>
				<button class="mgmt-button">永恒币说明</button>
			</view>

			<!-- Hint Text -->
			<view class="hint-text">
				<text>更多管理功能请进入电脑版管理中心</text>
			</view>

		</view>

		<Footer></Footer>
		<!-- End Main Content Area -->


		<!-- No Floating Button shown in this screenshot -->

	</view>
</template>

<script setup>
	import Footer from '@/components/footer/index.vue'
	import Header from '@/components/header/index.vue'
	import { getUserInfo } from '@/api/user.js'
	import { ref, reactive, toRaw } from 'vue';
	import { onLoad } from '@dcloudio/uni-app'
	// Vue 3 setup syntax
	// No complex logic needed for just layout还原

	// Example methods for navigation (replace with actual Uniapp routing)
	const goBack = () => {
		console.log('Go back');
		// uni.navigateBack();
	};

	const goHome = () => {
		console.log('Go home');
		// uni.reLaunch({ url: '/pages/index/index' }); // Example home page
	};

	const goToUserInfo = () => {
		uni.navigateTo({
			url: '/pages/graveyardManage/userInfo/index'
		})
	}
	const goToFamily = () => {
		uni.navigateTo({
			url: '/pages/graveyardManage/familyManage/index'
		})
	}
	const goToPayInfo = () => {
		uni.navigateTo({
			url: '/pages/graveyardManage/payInfo/index'
		})
	}


	const goToManage = () => {
		uni.navigateTo({
			url: '/pages/graveyardManage/manage/index'
		})
	}
	
	// 获取个人信息
	const userInfo = ref({})
	const getUserInfoFun = async () => {
		await getUserInfo().then(res=>{
			console.log(res)
			userInfo.value = res.data
			console.log(toRaw(userInfo.value))
		}).catch(error=>{
			console.log(error)
		})
	}
	
	onLoad( async ()=>{
		await getUserInfoFun()
	})
</script>

<style scoped>
	/* Scoped styles for this page */
	.container {
		display: flex;
		flex-direction: column;
		min-height: 100vh;
		/* Ensure container takes full height */
		background-color: #f5f5f5;
		/* Match background color */
		padding-bottom: 40rpx;
		/* Add some padding at the bottom */
		box-sizing: border-box;
		/* Include padding in height calculation */
	}

	/* Custom Header Styles - Adjusted for this page's layout */
	.custom-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		height: 88rpx;
		/* Standard header height */
		padding: 0 20rpx;
		background-color: #fff;
		border-bottom: 1rpx solid #eee;
	}

	.header-left {
		display: flex;
		/* Use flex to arrange icons */
		align-items: center;
		width: 120rpx;
		/* Adjust width for icons */
	}

	.header-icon {
		font-size: 40rpx;
		color: #333;
		margin-right: 30rpx;
		/* Space between icons */
	}

	.header-right {
		display: flex;
		align-items: center;
		font-size: 26rpx;
		color: #ff9800;
		/* Orange color */
		/* Adjust width or let content dictate */
	}

	.header-phone {
		margin-right: 15rpx;
		font-weight: bold;
		color: #ff9800;
		/* Orange color */
	}

	.header-link {
		margin-left: 15rpx;
		/* Space between links */
		/* Text color is orange from parent */
	}


	/* Banner Styles - Copied from previous pages */
	.banner {
		width: 100%;
		height: 300rpx;
		/* Adjust height as needed */
		position: relative;
		overflow: hidden;
	}

	.banner-bg {
		width: 100%;
		height: 100%;
		position: absolute;
		top: 0;
		left: 0;
	}

	.banner-overlay {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		padding: 30rpx 40rpx;
		/* Adjust padding */
		color: #fff;
		/* Text color on banner */
		text-shadow: 1rpx 1rpx 2rpx rgba(0, 0, 0, 0.5);
	}

	.banner-title-area {
		display: flex;
		align-items: flex-end;
	}

	.banner-main-title {
		font-size: 50rpx;
		/* Adjust font size */
		font-weight: bold;
		margin-right: 20rpx;
	}

	.banner-sub-area {
		display: flex;
		flex-direction: column;
		font-size: 24rpx;
		/* Adjust font size */
	}

	.banner-url {
		font-size: 20rpx;
		/* Adjust font size */
	}

	.banner-slogan-area {
		display: flex;
		justify-content: flex-end;
		/* Align to the right */
		font-size: 36rpx;
		/* Adjust font size */
	}

	.banner-slogan {
		margin-left: 30rpx;
		/* Spacing between slogans */
		font-weight: bold;
	}


	/* Page Title */
	.page-title {
		font-size: 36rpx;
		font-weight: bold;
		text-align: center;
		margin-top: 40rpx;
		/* Space below banner */
		margin-bottom: 30rpx;
		/* Space above main content card */
		color: #333;
	}


	/* Main Content Area (White Card) */
	.main-content {
		background-color: #fff;
		/* White background */
		margin: 0 20rpx;
		/* Side margins */
		padding: 30rpx;
		/* Inner padding */
		border-radius: 10rpx;
		box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
		/* Subtle shadow */
		display: flex;
		flex-direction: column;
		align-items: center;
		/* Center children horizontally */
	}

	/* Account Info Styles */
	.account-info {
		width: 100%;
		/* Take full width within the card */
		margin-bottom: 40rpx;
		/* Space below account info */
		font-size: 28rpx;
		/* Base font size for info */
	}

	.info-line {
		display: flex;
		align-items: center;
		margin-bottom: 15rpx;
		/* Space between lines */
	}

	.info-line:last-child {
		margin-bottom: 0;
	}

	.info-label {
		color: #333;
		margin-right: 10rpx;
		min-width: 120rpx;
		/* Align labels if needed */
	}

	.info-value {
		color: #555;
		flex-grow: 1;
		/* Allow value to take space */
	}

	.phone-number {
		color: #ff9800;
		/* Orange color for phone number */
		font-weight: bold;
	}

	.info-action {
		color: #999;
		/* Gray color for action link */
		margin-left: 20rpx;
		/* Optional: add underline */
		/* text-decoration: underline; */
	}

	/* Management Buttons Styles */
	.management-buttons {
		width: 100%;
		/* Take full width within the card */
		display: flex;
		flex-direction: column;
	}

	.mgmt-button {
		/* Uniapp button default styles need override */
		width: 100%;
		/* Take full width */
		height: 80rpx;
		/* Button height */
		line-height: 80rpx;
		font-size: 30rpx;
		color: #333;
		background-color: #e0e0e0;
		/* Light gray background */
		border: none;
		/* Remove default border */
		border-radius: 8rpx;
		/* Rounded corners */
		margin: 0 0 20rpx 0;
		/* Margin between buttons */
		text-align: center;
		/* Center text */
		display: flex;
		/* Use flex to center text */
		align-items: center;
		justify-content: center;
	}

	.mgmt-button:last-child {
		margin-bottom: 0;
		/* No bottom margin for the last button */
	}

	/* Hint Text Styles */
	.hint-text {
		margin-top: 30rpx;
		/* Space above hint text */
		text-align: center;
		font-size: 24rpx;
		color: #999;
	}

	/* QR Codes Section - Copied from previous pages */
	.qr-codes-section {
		display: flex;
		justify-content: space-around;
		padding: 40rpx 0;
		/* Vertical padding */
		margin-top: 30rpx;
		/* Space above section */
		margin-left: 20rpx;
		/* Side margins to align with card */
		margin-right: 20rpx;
	}

	.qr-item {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.qr-image {
		width: 200rpx;
		height: 200rpx;
		/* Need actual images */
		background-color: #eee;
		/* Placeholder background */
	}

	.qr-label {
		font-size: 26rpx;
		color: #555;
		margin-top: 10rpx;
	}

	/* Footer Styles - Copied from previous pages */
	.footer {
		margin-top: 40rpx;
		padding: 40rpx 20rpx;
		background-color: #f0f0f0;
		/* Light gray background */
		text-align: center;
		margin-top: auto;
		/* Push footer to the bottom */
		box-sizing: border-box;
	}

	.footer-links {
		font-size: 26rpx;
		color: #555;
		margin-bottom: 20rpx;
	}

	.footer-links text {
		margin: 0 10rpx;
	}

	.footer-copyright {
		font-size: 22rpx;
		color: #888;
		display: flex;
		flex-direction: column;
		/* Display copyright lines in a column */
		align-items: center;
	}

	.footer-copyright text {
		margin-bottom: 5rpx;
	}
</style>